if {"::tcltest" ni [namespace children]} {
	package require tcltest
	namespace import ::tcltest::*
}

package require rl_json

test boolean-1.1 {Create a json boolean: 1} -body { #<<<
	json boolean 1
} -result true
#>>>
test boolean-1.2 {Create a json boolean: 0} -body { #<<<
	json boolean 0
} -result false
#>>>
test boolean-1.3 {Create a json boolean: truthy string: true} -body { #<<<
	json boolean true
} -result true
#>>>
test boolean-1.4 {Create a json boolean: truthy string: t} -body { #<<<
	json boolean t
} -result true
#>>>
test boolean-1.5 {Create a json boolean: truthy string: yes} -body { #<<<
	json boolean yes
} -result true
#>>>
test boolean-1.6 {Create a json boolean: truthy string: y} -body { #<<<
	json boolean y
} -result true
#>>>
test boolean-1.7 {Create a json boolean: truthy string: on} -body { #<<<
	json boolean on
} -result true
#>>>
test boolean-1.8 {Create a json boolean: truthy string: o (ambiguous prefix)} -body { #<<<
	json boolean o
} -returnCodes error -result {expected boolean value but got "o"}
#>>>
test boolean-1.9 {Create a json boolean: truthy number: 42} -body { #<<<
	json boolean 42
} -result true
#>>>
test boolean-1.10 {Create a json boolean: truthy number: 42.5} -body { #<<<
	json boolean 42.5
} -result true
#>>>
test boolean-1.11 {Create a json boolean: truthy number: 1e6} -body { #<<<
	json boolean 1e6
} -result true
#>>>
test boolean-1.12 {Create a json boolean: truthy number: positive bignum} -body { #<<<
	json boolean [expr {2**1000-1}]
} -result true
#>>>
test boolean-1.13 {Create a json boolean: truthy number: -42} -body { #<<<
	json boolean -42
} -result true
#>>>
test boolean-1.14 {Create a json boolean: truthy number: -42.5} -body { #<<<
	json boolean -42.5
} -result true
#>>>
test boolean-1.15 {Create a json boolean: truthy number: -1e6} -body { #<<<
	json boolean -1e6
} -result true
#>>>
test boolean-1.16 {Create a json boolean: truthy number: negative bignum} -body { #<<<
	json boolean [expr {-1*(2**1000-1)}]
} -result true
#>>>
test boolean-1.17 {Create a json boolean: json boolean true} -body { #<<<
	json boolean [json boolean 1]
} -result true
#>>>
test boolean-1.18 {Create a json boolean: json boolean false} -body { #<<<
	json boolean [json boolean 0]
} -result false
#>>>
test boolean-2.1 {Too few args} -body { #<<<
	set code [catch {
		json boolean
	} r o]
	list $code $r [dict get $o -errorcode]
} -result {1 {wrong # args: should be "*boolean value"} {TCL WRONGARGS}} -match glob
#>>>
test boolean-2.2 {Too many args} -body { #<<<
	set code [catch {
		json boolean foo bar
	} r o]
	list $code $r [dict get $o -errorcode]
} -result {1 {wrong # args: should be "*boolean value"} {TCL WRONGARGS}} -match glob
#>>>
test boolean-2.3 {Empty string} -body { #<<<
	set code [catch {
		json boolean ""
	} r o]
	list $code $r [dict get $o -errorcode]
} -result {1 {expected boolean value but got ""} {TCL VALUE NUMBER}}
#>>>
test boolean-2.4 {Non-truthy string} -body { #<<<
	set code [catch {
		json boolean maybe
	} r o]
	list $code $r [dict get $o -errorcode]
} -result {1 {expected boolean value but got "maybe"} {TCL VALUE NUMBER}}
#>>>

::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# tab-width: 4
# End:
# vim: ft=tcl foldmethod=marker foldmarker=<<<,>>> ts=4 shiftwidth=4

